package lianxi;

import java.util.Scanner;

/**
 * 饮料换购
 */
public class Main11 {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = n;
		int sl = 0;
		while(n>=3) {
			int t = n/3;
			sl = n%3;
			sum +=t;
			n = t+sl;
		}
		System.out.print(sum);
	}
}
